<template>
<div class="home">
    <van-empty
    v-if="list.length === 0"
    class="custom-image"
    image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
    description="暂无备案"
    />
    <div class="content" v-for="(item, index) in list" :key="index" @click="info(item)">
            <van-field
            input-align="right"
            label="企业名称"
            v-model="item.qy_name"
            readonly
        />
        <van-field
            input-align="right"
            label="姓名"
            v-model="item.name"
            readonly
        />
        <van-field
            input-align="right"
            label="身份证号"
            v-model="item.cardno"
            readonly
        />
        <van-field
            input-align="right"
            label="电话"
            v-model="item.tel"
            readonly
        />
        <van-field input-align="right" label="是否匹配上司机" :value="item.car_register_code ?'是':'否'" readonly />
        <van-field
            input-align="right"
            label="车牌号"
            v-model="item.car_number"
            readonly
        />
        <van-field
            input-align="right"
            label="备案时间"
            v-model="item.createTime1"
            readonly
        />
    </div>
</div>
</template>
<script>
import {
  findQyPeopleBaList
} from '@/api/gov/home/index'
import { Toast } from 'vant'
import moment from 'moment'
export default {
  name: 'component_name',
  data () {
    return {
      cardNo: '',
      list: []
    }
  },
  mounted () {
    this.cardNo = this.$route.query.cardNo
    this.getFindQyPeopleBaList()
  },
  methods: {
    // 查询列表
    getFindQyPeopleBaList () {
      findQyPeopleBaList({ cardno: this.cardNo }).then((res) => {
        if (res.data.errcode == 0) {
          this.list = res.data.data.results.map((v) => {
            v.createTime1 = moment(v.create_time).format('YYYY-MM-DD HH:mm:ss')
            return v
          })
        } else {
          Toast.fail(res.data.errmsg)
        }
      })
    },
    // 详情
    info (row) {
      this.$router.push({
        path: '/closedInfo',
        query: {
          register_code: row.register_code
        }
      })
    }
  }
}
</script>
<style scoped lang="less">
.home {
  width: 100%;
  overflow-x: hidden;
  /deep/.van-field__label {
    width: 9em;
    display: flex;
    align-items: center;
  }
  /deep/.van-field__error-message {
    text-align: right;
  }
  .content{
      border-bottom: 20px solid #f1f3f4;
  }
  .custom-image .van-empty__image {
    width: 90px;
    height: 90px;
  }
}
</style>
